package com.wmyg.antifake.utils;

/**
 * 
 * @author 唐先生 使用枚举类型来封装异常码和异常信息
 *
 */
public enum ResultCodeEnum {

	LIVING_DB_OK(1, "操作成功"),
	LIVING_DB_FAIL(0, "操作失败"),

	SYSTEMVALUE(0,"默认值");

	private int code;
	private String msg;

	public void setCode(int code) {
		this.code = code;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getMsg() {
		return this.msg;
	}

	public int getCode() {
		return this.code;
	}

	private ResultCodeEnum(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public static String getResponseMsg(int code) {
		for (ResultCodeEnum wrapperEnumError : ResultCodeEnum.values()) {
			if (code == wrapperEnumError.getCode()) {
				return wrapperEnumError.getMsg();
			}
		}
		return "未知错误";
	}

}
